﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using DTO;
namespace DAO
{
    public class DatMonDAO
    {
        public List<DatMonDTO> DanhSachDonHang()
        {
            List<DatMonDTO> ds = new List<DatMonDTO>();
            SqlConnection conn = new SqlConnection();
            conn = DataProvider.ConnectDB();

            SqlCommand cmd = new SqlCommand("proc_DanhSachDonHang", conn);
            SqlDataReader reader = cmd.ExecuteReader();
            while (reader.Read())
            {
                DatMonDTO dm = new DatMonDTO();
                dm.MaDM = reader.GetString(0);
                dm.MaKH = reader.GetString(1);
                dm.NgayGioDM = reader.GetDateTime(2);
                dm.MaTT = reader.GetInt32(3);
                dm.MaNVQL = reader.GetString(4);
                dm.TongTien = reader.GetDouble(5);
                ds.Add(dm);
            }
            conn.Close();
            return ds;
        }

    }
}
